<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
	<title>讲师详情 - 慕学在线网</title>
	<link rel="stylesheet" type="text/css" href="../../css/reset.css">
	<link rel="stylesheet" type="text/css" href="../../css/animate.css">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
    
    <script src="../../js/jquery.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function add_fav_courses(fav_id, fav_type){
            if($("#savesession").val()==""){
                var r = confirm("您还未登录，单击确定登录")
                if (r==true){
                    window.location.href="/login"
                }
            }
            $.ajax({
                type: "POST",
                url:"/org/add_fav",
                dataType:"json",
                data:JSON.stringify({'fav_id':fav_id, 'fav_type':fav_type}),
                contentType:"application/json;charset=utf-8",
                success: function(data) {
                    if(data.sta=="ok"){
                        var getid = document.getElementById("shownums"+fav_id);
                        var num = parseInt(getid.innerHTML)
                        getid.innerHTML = num+1;
                    }
                    if (data.sta=="no"){
                        var getid = document.getElementById("shownums"+fav_id);
                        var num = parseInt(getid.innerHTML)
                        getid.innerHTML = num-1;
                    }
                },
            });
        }
        function add_fav(fav_id, fav_type){
            if($("#savesession").val()==""){
                var r = confirm("您还未登录，单击确定登录")
                if (r==true){
                    window.location.href="/login"
                }
            }
            $.ajax({
                type: "POST",
                url:"/org/add_fav",
                dataType:"json",
                data:JSON.stringify({'fav_id':fav_id, 'fav_type':fav_type}),
                contentType:"application/json;charset=utf-8",
                success: function(data) {
                    if(data.sta=="ok"){
                        $("#jsRightBtn").html("已收藏")
                    }
                    if (data.sta=="no"){
                        $("#jsRightBtn").html("收藏")
                    }
                },
            });
        }
        function add_fav_course(fav_id, fav_type){
            if($("#savesession").val()==""){
                var r = confirm("您还未登录，单击确定登录")
                if (r==true){
                    window.location.href="/login"
                }
            }
            $.ajax({
                type: "POST",
                url:"/org/add_fav",
                dataType:"json",
                data:JSON.stringify({'fav_id':fav_id, 'fav_type':fav_type}),
                contentType:"application/json;charset=utf-8",
                success: function(data) {
                    if(data.sta=="ok"){
                        $('#jsLeftBtn').html("已收藏")
                    }
                    if (data.sta=="no"){
                        $('#jsLeftBtn').html("收藏")
                    }
                },
            });
        }
        function startstudy(course_id,user_id) {
            if (user_id == null || user_id == "") {
                var r = confirm("您还未登录，单击确定登录")
                if (r == true) {
                    window.location.href = "/login"
                }
            } else {
                $.ajax({
                    url: "/startstudy",
                    type: "POST",
                    dataType: "json",
                    contentType: "application/json;charset=utf-8",
                    data: JSON.stringify({'course_id': course_id, 'user_id': user_id}),
                    success: function (data) {
                        if (data.sta == "ok") {
                            alert("记录成功");
                            window.location.href="/course-video?id="+course_id;
                        }
                    }
                });
            }
        }
    </script>
    <script type="text/javascript">
        function checkisfav() {
            if ($("#isSave").val()=="yes"){
                $("#jsRightBtn").html("已收藏")
            }else{
                if($("#isSave").val()=="no"){
                    $("#jsRightBtn").html("收藏")
                }
            }
            if ($("#isSave2").val()=="yes"){
                $("#jsLeftBtn").html("已收藏")
            }else{
                $("#jsLeftBtn").html("收藏")
            }
        }
    </script>
    <script src="../../js/jquery.min.js" type="text/javascript"></script>
    <script src="../../../js/message.js" type="text/javascript"></script>
    <script src="../../js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var ctx = "${sessionScope.user_session}";
    </script>
</head>
<body onload="checkisfav(),setTimeout('getcount()',1000)">
<section class="headerwrap ">
    <header>
		<div  class=" header">
 			<div class="top">
				<div class="wp">
					<div class="fl"><p>服务电话：<b>13280797579</b></p></div>
					<!--登录后跳转-->
                    <c:choose>
                        <c:when test="${sessionScope.user_session!=null}">
                            <div class="personal">
                                <dl class="user fr">
                                    <dd>${sessionScope.user_session.username}<img class="down fr" src="${pageContext.request.contextPath}/images/top_down.png"/></dd>
                                    <dt><img width="20" height="20" src="${pageContext.request.contextPath}${sessionScope.user_session.image}"/></dt>
                                </dl>
                                <div class="userdetail">
                                    <dl>
                                        <dt><img width="80" height="80" src="${pageContext.request.contextPath}${sessionScope.user_session.image}"/></dt>
                                        <dd>
                                            <h2>${sessionScope.user_session.username}</h2>
                                            <p>用户</p>
                                        </dd>
                                    </dl>
                                    <div class="btn">
                                        <a class="personcenter fl" href="${pageContext.request.contextPath}/usercenter">进入个人中心</a>
                                        <a class="fr" href="${pageContext.request.contextPath}/logout">退出</a>
                                    </div>
                                </div>
                                <a href="/message">
                                    <div class="msg-num"><span id="MsgNum"></span></div>
                                </a>
                            </div>
                        </c:when>
                        <c:otherwise>
                            <a style="color:white" class="fr registerbtn" href="/register">注册</a>
                            <a style="color:white" class="fr loginbtn" href="${pageContext.request.contextPath}/login">登录</a>
                        </c:otherwise>
                    </c:choose>

				</div>
			</div>

            <div class="middle">
                <div class="wp">
                    <a href="/index"><img class="fl" src="../../images/logo.jpg"/></a>
                    <div class="searchbox fr">
                        <div class="selectContainer fl">
                            <span class="selectOption" id="jsSelectOption" data-value="course">
                                公开课
                            </span>
                            <ul class="selectMenu" id="jsSelectMenu">
                                <li data-value="course">公开课</li>
                                <li data-value="org">课程机构</li>
                                <li data-value="teacher">授课老师</li>
                            </ul>
                        </div>
                        <input id="search_keywords" class="fl" type="text" value="" placeholder="请输入搜索内容"/>
                        <input type="hidden" id="savesession" value="${sessionScope.user_session}">
                        <input type="hidden" id="isSave" value="${favflag}">
                        <input type="hidden" id="isSave2" value="${favflag1}">
                        <img class="search_btn fr" id="jsSearchBtn" src="../../images/search_btn.png"/>
                    </div>
                </div>
            </div>
            
            
			<nav>
				<div class="nav">
					<div class="wp">
						<ul>
							<li ><a href="/index">首页</a></li>
							<li >
								<a href="/course-list">
									公开课<img class="hot" src="../../images/nav_hot.png">
								</a>
							</li>
							<li class="active">
								<a href="/showTeacherList">授课教师</a>
							</li>
							<li ><a href="/org_list">授课机构</a></li>
						</ul>
					</div>
				</div>
			</nav>
            
			</div>
    </header>
</section>
<!--crumbs start-->

    <section>
        <div class="wp">
            <ul  class="crumbs">
                <li><a href="/index">首页</a>></li>
                <li><a href="/showTeacherList">授课讲师</a>></li>
                <li>讲师详情</li>
            </ul>
        </div>
    </section>


    <section>
	<div class="wp butler-detail-box butler-diaryd-box clearfix">
        <div class="fl list">
            <div class="butler_detail_list clearfix">
                <div class="brief">
                    <dl class="des">
                        <dt>
                            <div class="picpic">
                                <img width="100" height="100" src="../../media/teacher/2016/11/aobama_CXWwMef.png"/>
                            </div>
                            <div class="btn">
                                <span class="fl btn1 collectionbtn" id="jsLeftBtn" onclick="add_fav_course(${teacher.id},2)">
                                     收藏
                                </span>
                                <span class="fr btn2 shareBtn bdsharebuttonbox"
                                      data-text="授课教师-李老师-慕学网"
                                      data-desc="我在#慕课网#发现了"
                                      data-comment="李老师，工作年限：5年；学历：本科；所在公司：阿里巴巴&nbsp;；经典案例：django入门和深入；flask入门"
                                      data-url="/diary/hk_detail/10/">
                                    <span class="fl">分享</span>
                                    <a href="#" class="bds_more" data-cmd="more"></a>
                                </span>
                            </div>
                        </dt>
                        <dd>
                            <a href="/diary/hk_detail/10/">
                                <h1>${teacher.name}<span class="key picbig">金牌讲师</span></h1>
                            </a>
                            <ul class="cont">
                                <li>工作年限：<span>${teacher.work_years}年</span></li>
                                <li>就职公司：<span>${teacher.work_company}</span></li>
                                <li>工作职位：<span>${teacher.work_position}&nbsp;</span></li>
                                <li>教学特点：<span>${teacher.points}</span></li>
                            </ul>
                        </dd>
                    </dl>
                </div>
            </div>
            <div class="butler_detail_cont clearfix">
                <div class="left layout">
				<div class="head">
					<ul class="tab_header">
						<li class="active"><a href="/diary/hk_detail/10/">全部课程</a> </li>
					</ul>
				</div>
                    <div class="companycenter">
                        <div class="group_list brief">
                            <c:forEach items="${teacher.courses}" var="course">
                                <div class="module1_5 box">
                                    <a href="/course-detail?id=${course.id}">
                                        <img width="214" height="190" class="scrollLoading" src="${course.image}"/>
                                    </a>
                                    <div class="des">
                                        <a href="/course-detail?id=${course.id}"><h2>${course.name}</h2></a>
                                        <span class="fl">时长：<i class="key">${course.learn_time}</i></span>
                                        <span class="fr">学习人数：${course.students}</span>
                                    </div>
                                    <div class="bottom">
                                        <span class="fl">${course.organization.name}</span>
                                        <span class="star fr  notlogin" id="shownums${course.id}" onclick="add_fav_courses(${course.id},3)">${course.fav_nums}</span>
                                    </div>
                                </div>
                            </c:forEach>



                        </div>
                    </div>
                <!--<div class="pageturn">-->
                    <!--<ul class="pagelist">-->
                        <!--<li class="active"><a href="?page=1">1</a></li>-->
                    <!--</ul>-->
                <!--</div>-->
            </div>
            </div>
        </div>
        <div class="fr list">
             <div class="butler_detail_list">
                <div class="right butler-company-box">
                <div class="head">
                    <h1>${teacher.organization.name}</h1>
                    <p>知名${teacher.organization.ct}，权威教学</p>
                </div>
                <div class="pic">
                    <a href="/org_home?id=${teacher.organization.id}">
                        <img width="150" height="80" src="${teacher.organization.image}"/>
                    </a>
                </div>
                <a href="/org_home?id=${teacher.organization.id}">
                    <h2 class="center">${teacher.organization.name}</h2>
                </a>
                <p class="center tell">地址：${teacher.organization.address}</p>
                <a class="btn" id="jsRightBtn" onclick="add_fav(${teacher.organization.id},1)">收藏</a>
            </div>
            </div>
            <div class="butler_detail_cont">
                <div class="butler_list_box">
                    <div class="right layout">
                        <div class="head">讲师排行榜</div>
                        
                        <dl class="des">
                            <span class="num fl">1</span>
                            <a href="/org/teacher/detail/1/">
                                <dt>
                                    <img width="50" height="50" class="scrollLoading" src="../../media/teacher/2016/11/aobama_CXWwMef.png"/>
                                </dt>
                            </a>
                            <dd>
                                <a href="/org/teacher/detail/1/">
                                    <h1 title="bobby">bobby</h1>
                                </a>
                                <p>工作年限：<span>5年</span></p>
                            </dd>
                        </dl>
                        
                        <dl class="des">
                            <span class="num fl">1</span>
                            <a href="/org/teacher/detail/2/">
                                <dt>
                                    <img width="50" height="50" class="scrollLoading" src="../../media/teacher/2016/11/aobama.png"/>
                                </dt>
                            </a>
                            <dd>
                                <a href="/org/teacher/detail/2/">
                                    <h1 title="还是bobby">还是bobby</h1>
                                </a>
                                <p>工作年限：<span>5年</span></p>
                            </dd>
                        </dl>
                        

                    </div>
                </div>
            </div>
        </div>
	</div>
</section>

<footer>
		<div class="footer">
			<div class="wp">
				<ul class="cont">
					<li class="logo"><a href=""><img src="../../images/footlogo.png"/></a></li>
					<li class="code"><img src="../../images/code.jpg"/><p class="center">扫描关注微信</p></li>
					<li class="third"><img class="fl" src="../../images/tell.png"/><p class="tell">13280797579</p><p class="time">周一至周日 9:00-18:00</p></li>
				</ul>

			</div>
			<p class="line"></p>
			<div class="wp clear">
                <span class="fl">? 2016 www.projectsedu.com 慕学在线-在线学习交流平台 保留所有权利</span>
                <span class="fr">copyright ? 2016 ICP备案证书号：蜀ICP备xxxxx号-1</span>
			</div>
		</div>
	</footer>

<section>
    <ul class="sidebar">
        <li class="qq">
            <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2023525077&site=qq&menu=yes"></a>
        </li>
        <li class="totop"></li>
    </ul>
</section>
<script src="../../js/selectUi.js" type='text/javascript'></script>
<script src="../../js/deco-common.js" type='text/javascript'></script>
<script type="text/javascript" src="../../js/plugins/laydate/laydate.js"></script>
<script src="../../js/plugins/layer/layer.js"></script>
<script src="../../js/plugins/queryCity/js/public.js" type="text/javascript"></script>
<script src="../../js/unslider.js" type="text/javascript"></script>
<script src="../../js/plugins/jquery.scrollLoading.js"  type="text/javascript"></script>
<script src="../../js/deco-common.js"  type="text/javascript"></script>

<script type="text/javascript">


</script>


</body>
</html>
